#include <iostream>
#include<set>
using namespace std;

typedef long long ll;
const ll INF = 1e10 + 10;
set<ll> mp;
int n, op;
ll len;
int main()
{
	cin >> n;
	mp.insert(-INF);
	mp.insert(INF);
	while(n--)
	{
		cin >> op >> len;
		if(op == 1)
		{
			if(mp.count(len))
			    cout << "Already Exist" << endl;
			else
			    mp.insert(len);
		}
		else
		{
			if(mp.size() == 2)
				cout << "Empty" << endl;
			else
			{
				if(mp.count(len))
			    {
				    cout << len << endl;
			        mp.erase(len);
			    }
			    else
			    {
				    auto t = mp.lower_bound(len);
				    auto tmp = t;
				    tmp--;
				    if(abs(*tmp - len) <= abs(*t - len))
				    {
				    	cout << *tmp << endl;
				        mp.erase(*tmp);
					}
				    else
				    {
				    	cout << *t << endl;
				        mp.erase(*t);
					}
			    }
			}
			    
		}		
	}
	return 0;
}
